package thread.forkjoin;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;

/**
 * @program: Multhread
 * @description: 计算1-1000的和
 * @author: zhanghz001
 * @create: 2021-03-05 11:05
 **/
public class SumTask {
    public static void main1(String[] args) throws ExecutionException, InterruptedException {
        ForkJoinPool pool = new ForkJoinPool();
        ForkJoinTask<Integer> task = pool.submit(new SubTask(0, 1000));
        System.out.println(task.get());
    }
    
}
